package com.tianpengtech.admin.websitewh;
import com.jfinal.aop.Before;
import com.jfinal.plugin.activerecord.Model;
import com.tianpengtech.admin.AbstractAdminController;
import com.tianpengtech.admin.InitInterceptor;
import com.tianpengtech.admin.dictionary.DictionaryDao;
import com.tianpengtech.common.exception.ValidateException;
import com.tianpengtech.common.model.dictionary.Dictionary;
import com.tianpengtech.common.model.fair.Fair;
import com.tianpengtech.common.model.websitewh.WebSiteWh;
import com.tianpengtech.common.util.XxxUtil;

/**
* 路由配置地址：add("/admin/websitewh", WebSiteWhAdminController.class, "/admin/websitewh");
* 数据库映射地址：arp.addMapping(WebSiteWh.dao.tableName(),WebSiteWh.class);
*/
@Before(InitInterceptor.class)
public class WebSiteWhAdminController extends AbstractAdminController{

	@Override
	protected void config() {
		this.clazz=WebSiteWh.class;
		this.service=new WebSiteWhAdminServiceImpl();
	}

	@Override
	public void beforeAdd() {
		setAttr("lable",DictionaryDao.ME.readParents(Dictionary.WEB_SITE_LABEL));
	}

	@Override
	public void beforeAdd(Model< ? > model) throws ValidateException {
		String[] lables = getParaValues("webSiteWh."+WebSiteWh.LABLE);
		model.set(WebSiteWh.LABLE,XxxUtil.arr2str(lables)); 
	}

	@Override
	public void beforeQueryById(Model<?> model, int id) {
		setAttr("lable",DictionaryDao.ME.readParents(Dictionary.WEB_SITE_LABEL));
	}

	@Override
	public void beforeUpdate(Model< ? > model) throws ValidateException {
		String[] lables = getParaValues("webSiteWh."+WebSiteWh.LABLE);
		model.set(WebSiteWh.LABLE,XxxUtil.arr2str(lables));
	}

	@Override
	public void beforeDelete(Model< ? > model) {

	}

	@Override
	public void parsePageRecord(Object results) {
		
	}
}

	